//
//  UnityTool.h
//  xieyingze
//
//  Created by xieyingze on 16/6/12.
//  Copyright © 2016年 xieyingze. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "AppHeader.h"

@interface UnityTool : NSObject

+ (instancetype)shareInstance;
/**
 是否正在验证手势密码
 */
@property (nonatomic, assign) BOOL showingGesturePassword;

#pragma mark - ************************用户信息相关************************

/**
 获取UUID
 */
- (NSString *)getUUID;

/**
 获取UserID
 */
- (NSString *)userId;

/**
 判断是否登录
 */
- (BOOL)isLogin;

+(BOOL)isLogin;

#pragma mark - ************************计算相关************************
/**
 计算利润
 */
- (float)calculateProfitWithmoney:(float)money days:(NSUInteger)days rate:(float)rate;

#pragma mark - ************************金额输入处理************************
/**
 处理金额输入框输入
 */
- (BOOL)handMoneyTextField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string;

#pragma mark - ************************RSA加密************************

/**
 RSA公钥加密
 */
+ (NSString *)encryptString:(NSString *)str publicKey:(NSString *)pubKey;

/**
 RSA私钥解密
 */
+ (NSString *)decryptString:(NSString *)str privateKey:(NSString *)privKey;

#pragma mark - ************************MD5加密************************
/**
 加密字符串
 */
+ (NSString *)md5ForString:(NSString*)str;
/**
 加密data
 */
+ (NSString *)md5ForData:(NSData *)data;

#pragma mark - ************************数据处理************************
/**
 字典转换为字符串
 */
+ (NSString *)jsonStrForDic:(NSDictionary *)dic;

#pragma mark - ************************控制器相关************************

/**
 主界面pop到root控制器
 */
+ (void)allViewControllerPopRootViewController;

#pragma mark - ************************NSUserDefault存取值************************

/**
 存储key-value值
 */
+ (void)setStringValue:(NSString *)value forKey:(NSString *)key;

/**
 根据字符串获取存储的bool值
 */
+ (void)setBoolValue:(BOOL)objValue forKey:(NSString *)key;

/**
 根据字符串获取存储的bool值
 */
+ (BOOL)getBoolValueForKey:(NSString *)key;

/**
 根据字符串获取存储的string值
 */
+ (NSString *)getStringValueForKey:(NSString *)key;

+ (void)removeValueWithKey:(NSString *)objectKey;

#pragma mark - ************************缓存************************
/**
 获取缓存
 */
- (CGFloat)getCacheSize;

/**
 清除缓存
 */
- (void)cleanCache;

#pragma mark - ************************缓存************************
/**
 产生随机数
 @param from 上限
 @param to 下限
 @return 随机数
 */
+ (int)getRandomNumber:(int)from to:(int)to;


+ (void)setValueToPlistWithPlistName:(NSString *)plistname value:(id)value key:(NSString *)key;
//从plist配置文件中通过key取出value
+ (id)getValueToPlistWithPlistName:(NSString *)plistname key:(NSString *)key;

@end
